package com.example.demo.main;

import com.example.demo.utils.ExcelUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.Map;

public class Main {

    public static void main(String[] args) {
        System.out.println("asa");
        String a= "asa";
        ExcelUtils excelUtils = new ExcelUtils();
        try {
            Workbook workbook = excelUtils.getWorkBook(new FileInputStream("C:\\Users\\Administrator\\Desktop\\网易云官网页面所属业务线0413.xlsx"));
            Sheet sheet = excelUtils.getSheetByName(workbook, "Sheet1");
            if (sheet != null) {
                Map<Integer, List<String>> result = excelUtils.readSheet(sheet);
                result.forEach(
                        (rowNum, rowValues) -> {
                            String desc = rowValues.get(0);
                            String url = rowValues.get(1);
                            String biz = rowValues.get(2);
                            if(url != null && !url.isEmpty()){
                                System.out.println("desc: "+desc+"; url: "+url+"; biz: "+biz);
                            }
                        }
                );
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
